language: cpp
cache:
  apt: true
os:
- linux
#- osx
dist: trusty
sudo: required
compiler:
- g++
- clang++
env:
  global:
  - MAKEFLAGS="-j 2"
  matrix:
  - BUILD_TYPE=make UPNP=ON MAKE_UPNP=yes
  - BUILD_TYPE=make UPNP=OFF MAKE_UPNP=no
  - BUILD_TYPE=cmake UPNP=ON MAKE_UPNP=yes
  - BUILD_TYPE=cmake UPNP=OFF MAKE_UPNP=no
matrix:
  exclude:
  - os: osx
    env: BUILD_TYPE=cmake UPNP=ON MAKE_UPNP=yes
  - os: osx
    env: BUILD_TYPE=cmake UPNP=OFF MAKE_UPNP=no
  - os: linux
    compiler: clang++
    env: BUILD_TYPE=make UPNP=ON MAKE_UPNP=yes
  - os: linux
    compiler: clang++
    env: BUILD_TYPE=make UPNP=OFF MAKE_UPNP=no
addons:
  apt:
    packages:
    - build-essential
    - cmake
    - g++
    - clang
    - libboost-chrono-dev
    - libboost-date-time-dev
    - libboost-filesystem-dev
    - libboost-program-options-dev
    - libboost-system-dev
    - libboost-thread-dev
    - libminiupnpc-dev
    - libssl-dev
before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install libressl miniupnpc ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew outdated boost || brew upgrade boost ; fi
script:
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$BUILD_TYPE" == "cmake" ]]; then cd build && cmake -DCMAKE_BUILD_TYPE=Release -DWITH_UPNP=${UPNP} && make ; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" && "$BUILD_TYPE" == "make" ]]; then make USE_UPNP=${MAKE_UPNP} ; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then make HOMEBREW=1 USE_UPNP=${MAKE_UPNP} ; fi
